<!-- 我的-关于我们 -->
<template>
	<view class="page-box">
		<view class="main-box">
			<image style="width: 200rpx;height: 200rpx;" :src="images.logo"></image>
			<text class="title">DD友伴</text>
			<!-- <text class="title">寻觅搭子</text> -->
			<view class="box">
				<view class="item" @tap.stop="handleXXX(1)">
					<text class="item-l">用户协议</text>
					<image style="width: 20rpx;height: 20rpx;" src="/static/images/rightIcon.png"></image>
				</view>
				<view class="item" @tap.stop="handleXXX(2)">
					<text class="item-l">隐私政策</text>
					<image style="width: 20rpx;height: 20rpx;" src="/static/images/rightIcon.png"></image>
				</view>
				<view class="item" @tap.stop="handleXXX(3)">
					<text class="item-l">平台介绍</text>
					<image style="width: 20rpx;height: 20rpx;" src="/static/images/rightIcon.png"></image>
				</view>
				<view class="item">
					<text class="item-l">版本信息</text>
					<view class="item-r">v1.0.0</view>
				</view>
<!-- 				<view class="item" @tap="handleCall">
					<text class="item-l">联系客服</text>
					<view class="item-r">{{contactInfo}}</view>
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
import imgs from '@/static/images/index.js'

	import {
		copyClipboard,
	} from '@/utils/index.js'
	import {
		getContactMe
	} from '@/api/user.js'
	export default {
		data() {
			return {
				images: {}, // 图片组

				isXXX: false,
				contactInfo: ''
			};
		},
		onLoad() {
			this.images = {...imgs}

			getContactMe().then(res => {
				const index = res.data.contactInfo.indexOf('@')
				this.isXXX = index !== -1
				if (this.isXXX) {
					this.contactInfo = res.data.contactInfo.slice(1, res.data.contactInfo.length)
				} else {
					this.contactInfo = res.data.contactInfo
				}
			})
		},
		methods: {
			handleXXX(e) {
				uni.navigateTo({
					url: e === 1 ? '/pages/me/userAgreement' : e === 2 ? '/pages/me/privacyAgreement' :
						'/pages/me/introduce'
				})
			},
			handleCall() {
				const that = this
				if (!this.isXXX) {
					location.href = `tel:${this.contactInfo}`;
				} else {
					uni.showModal({
						title: `微信号：${this.contactInfo}`,
						confirmText: '复制',
						cancelColor: '关闭',
						success(res) {
							if (res.confirm) {
								copyClipboard(that.contactInfo, '微信号已复制，添加微信后可联系我们')
							} else if (res.cancel) {}
						}
					});
				}
			},
		}
	}
</script>

<style lang="scss">
	.page-box {
		position: relative;
		box-sizing: border-box;
		background: linear-gradient(180deg, rgba(238, 212, 215, 0.8) 0%, rgba(202, 191, 192, 0) 100%);
		min-height: 100vh;

	}

	.main-box {
		position: absolute;
		box-sizing: border-box;
		top: 0;
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 40rpx 20rpx;

		.box {
			box-sizing: border-box;
			border-radius: 20rpx;
			display: flex;
			flex-direction: column;
			width: 100%;
			margin-top: 80rpx;
			padding: 0 24rpx;
			background: rgba(140, 138, 138, 0.1);

			.item {
				box-sizing: border-box;
				width: 100%;
				display: flex;
				justify-content: space-between;
				font-size: 24rpx;
				padding: 34rpx 0rpx;
				border-bottom: 2rpx solid rgba(140, 138, 138, 0.3);

				&:last-child {
					border: 0;
				}

				.item-l {
					font-size: 28rpx;
					font-weight: bold;
					color: #0F0D21;
					width: 120rpx;
				}

				.item-r {
					color: #8C8A8A;
				}
			}
		}
	}

	.title {
		margin-top: 40rpx;
		font-weight: bold;
		font-size: 40rpx;
	}
</style>